package com.example.administrator.questionanswer.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.example.administrator.questionanswer.greendao.AnswerBean;
import com.example.administrator.questionanswer.greendao.QuestionBean;
import com.example.administrator.questionanswer.greendao.UserBean;

import com.example.administrator.questionanswer.dao.AnswerBeanDao;
import com.example.administrator.questionanswer.dao.QuestionBeanDao;
import com.example.administrator.questionanswer.dao.UserBeanDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig answerBeanDaoConfig;
    private final DaoConfig questionBeanDaoConfig;
    private final DaoConfig userBeanDaoConfig;

    private final AnswerBeanDao answerBeanDao;
    private final QuestionBeanDao questionBeanDao;
    private final UserBeanDao userBeanDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        answerBeanDaoConfig = daoConfigMap.get(AnswerBeanDao.class).clone();
        answerBeanDaoConfig.initIdentityScope(type);

        questionBeanDaoConfig = daoConfigMap.get(QuestionBeanDao.class).clone();
        questionBeanDaoConfig.initIdentityScope(type);

        userBeanDaoConfig = daoConfigMap.get(UserBeanDao.class).clone();
        userBeanDaoConfig.initIdentityScope(type);

        answerBeanDao = new AnswerBeanDao(answerBeanDaoConfig, this);
        questionBeanDao = new QuestionBeanDao(questionBeanDaoConfig, this);
        userBeanDao = new UserBeanDao(userBeanDaoConfig, this);

        registerDao(AnswerBean.class, answerBeanDao);
        registerDao(QuestionBean.class, questionBeanDao);
        registerDao(UserBean.class, userBeanDao);
    }
    
    public void clear() {
        answerBeanDaoConfig.clearIdentityScope();
        questionBeanDaoConfig.clearIdentityScope();
        userBeanDaoConfig.clearIdentityScope();
    }

    public AnswerBeanDao getAnswerBeanDao() {
        return answerBeanDao;
    }

    public QuestionBeanDao getQuestionBeanDao() {
        return questionBeanDao;
    }

    public UserBeanDao getUserBeanDao() {
        return userBeanDao;
    }

}
